package org.sam.swing.search;

import java.util.Map;

import org.jdesktop.swingx.JXFindPanel;
import org.jdesktop.swingx.search.SearchFactory;
import org.sam.swing.table.JSTable;

/**
 * 替换JXFindPanel为JSFindPanel
 * 
 * @author sam
 *
 */
public class JSSearchFactory extends SearchFactory {

	/**
	 * 字段列表
	 */
	private Map<Integer, String> columns;

	/**
	 * 字段列表
	 */
	public Map<Integer, String> getColumns() {
		return columns;
	}

	/**
	 * 字段列表
	 */
	public void setColumns(Map<Integer, String> columns) {
		this.columns = columns;
	}

	/**
	 * 当前操作的表格对象
	 */
	private JSTable table;

	/**
	 * 当前操作的表格对象
	 * @return
	 */
	public JSTable getTable() {
		return table;
	}

	/**
	 * 当前操作的表格对象
	 * @param table
	 */
	public void setTable(JSTable table) {
		this.table = table;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public JXFindPanel createFindPanel() {
		JSFindPanel panel = new JSFindPanel();
		if (this.columns != null) {
			panel.setColums(this.columns);
			panel.setTable(this.table);
		}

		return panel;
	}

}
